package com.woniu.command.handle;

import com.woniu.adapter.PurchaseDetailAdapter;
import com.woniu.outlet.po.BomPo;
import com.woniu.outlet.po.PurchaseDetailPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PurchaseDetailCommandHandle {

    @Autowired
    private PurchaseDetailAdapter adapter;

    //添加采购详情
    public String addPurDetail(PurchaseDetailPo detailPo){
        try {
            adapter.addPurDetail(detailPo);
            return "添加成功";
        } catch (Exception e) {
            e.printStackTrace();
            return "添加失败"+e.getMessage();
        }
    }

    //修改采购详情
    public String updatePurDetail(PurchaseDetailPo detailPo){
        try {
            adapter.updatePurDetail(detailPo);
            return "修改成功";
        } catch (Exception e) {
            e.printStackTrace();
            return "修改失败"+e.getMessage();
        }
    }

    //删除采购详情
    public String deletePurDetailById(Long id){
        try {
            adapter.deletePurDetailById(id);
            return "删除成功";
        } catch (Exception e) {
            e.printStackTrace();
            return "删除失败";
        }
    }

}
